package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 攻略分类
 */
@Getter@Setter
@JsonIgnoreProperties("handler")//在转为json数据的时候,忽略序列化属性
public class StrategyCatalog extends BaseDomain{

    private String name;//名称

    private Strategy strategy;//所属攻略

    private Integer sequence;//序号

    private Boolean state;//状态

    private List<StrategyDetail> details = new ArrayList<>();//文章的集合

    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("sequence", sequence);
        map.put("state", state);
        if(strategy!=null){
            map.put("strategyId", strategy.getId());
        }
        return JSONUtil.toJSONString(map);
    }
}